	import {
		reactive,
	} from "@vue/composition-api";

export function pagination(){
	const pageData = reactive({
		currentPage:1,
		total:10,
		pageSizes:[2,4,8,10],
		pageSize:2,
		layout:"total, sizes, prev, pager, next, jumper"
	})
	const handleSizeChange =(val)=>{
		pageData.pageSize=val
		
	}
	const handleCurrentChange = (val)=>{
		pageData.currentPage = val
	}
	const getInitData = (val)=>{
		pageData.currentPage =val.data.pageNumber
		pageData.pageSize =val.data.pageSize
		val.layout&&(pageData.layout = val.layout)
	}
	
	return {
		pageData,
		handleSizeChange,
		handleCurrentChange,
		getInitData
		
	}
}